package com.example.common.config;

import com.example.common.filter.RequestFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean requestFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        RequestFilter filter = new RequestFilter();
        bean.setFilter(filter);
        // 添加一些初始化的参数，然后在过滤器中的init方法中得到
        bean.addInitParameter("age","5454545453453");
        bean.addUrlPatterns("/*");
        return bean;
    }
}
